# while循环
a = 10
while a >= 0:
    print(a)
    a -= 1

sum = 0
a = 0
while a <= 100:
    sum += a
    a += 1

print("1 - 100的和为%d" % sum)

# for循环和range语句（for循环后面跟的是序列类型）
name = "hescene"
for x in name:
    print(x)

for i in range(len(name)):
    print(f"{name[i]},{i}")

for i in range(0, len(name)):
    print(f"{name[i]},{i}")

for i in range(0, len(name), 2):
    print(f"{name[i]},{i}")

# 注意在外面也能访问i，不建议这样写
print(i)


# 循环中断break和continue
for i in range(0, len(name)):
    if i % 2 == 0:
        continue
    print(name[i], i)

for i in range(0, len(name)):
    if name[i] == "e":
        break
    print(name[i], i)